class Solution {
    /*
        4个对称元素的坐标分别是
        x1:[L][L+i]
        x2:[L+i][R]
        x3:[R][R-i]
        x4:[R-i][L]
    */
    public void rotate(int[][] matrix) {
        int count = matrix.length/2;
        for(int i=0; i<count; i++){
            ope(matrix,0+i,matrix.length-1-i);
        }
    }
    // 对l列，r列，l行，r行这一圈元素进行旋转
    public void ope(int[][] matrix,int L,int R) {
        for(int move=0; move<=R-L-1; move++){
            int tmp = matrix[L][L+move];
            matrix[L][L+move] = matrix[R-move][L];
            matrix[R-move][L] = matrix[R][R-move];
            matrix[R][R-move] = matrix[L+move][R];
            matrix[L+move][R] = tmp;
        }
    }
}